<template>
    <div id="app">
      <el-form :model="news" label-width="100px">
        <el-form-item label="标题" prop="title">
          <el-input v-model="news.title"></el-input>
        </el-form-item>

        <el-form-item label="作者" prop="author">
          <el-input v-model="news.author"></el-input>
        </el-form-item>

        <el-form-item label="内容" prop="content">
          <el-input v-model="news.content"  type="textarea" rows="5"></el-input>
        </el-form-item>

        <el-form-item label="主题" prop="title">
          <el-input v-model="news.summary"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click.prevent="test">保存</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          news:{}
        }
      },
      methods:{
        test(){

            this.$confirm("是否确认提交","保存提示").then(()=>{
              this.axios.post("/news/add",this.news).then((resp)=>{
                  this.$message.success("保存成功！");
                  this.$router.push("/news/NewsList")
                });
            });

        }
      }
    }
</script>


<style scoped>

</style>
